/*
 * main.cc
 *
 *  Created on: Nov 27, 2010
 *      Author: fify
 */

#include <stdio.h>
#include <algorithm>
#include <stack>

using namespace std;

class Level
{
public:
	int height, width;

	int pre, next;
};

Level level[100005];
long long result[100005];
long long water;

void fill(int now, int n)
{
	water = 0;

	for(int i = 0;i<n;i++)
	{
		while(level[level[now].pre].height < level[now].height)
		{
			now = level[now].pre;
		}
		while(level[level[now].next].height < level[now].height)
		{
			now = level[now].next;
		}

		result[now] = water + level[now].width;

		if(level[level[now].next].height < level[level[now].pre].height)
		{
			level[level[now].pre].next = level[now].next;
			level[level[now].next].pre = level[now].pre;

			level[level[now].next].width += level[now].width;

			water += (long long)level[now].width * (level[level[now].next].height - level[now].height);

			now = level[now].next;
		}
		else
		{
			level[level[now].next].pre = level[now].pre;
			level[level[now].pre].next = level[now].next;

			level[level[now].pre].width += level[now].width;

			water += (long long)level[now].width * (level[level[now].pre].height - level[now].height);

			now = level[now].pre;
		}
	}
}

void solve(int n)
{
	level[n+1].height = level[0].height = 0x7fffffff;
	level[n+1].width = level[0].width = 0;

	int now = 0;

	for(int i = 1;i<=n;i++)
	{
		scanf("%d%d", &level[i].width, &level[i].height);

		level[i].pre = i - 1;
		level[i].next = i + 1;

		if(level[i].height < level[now].height)
		{
			now = i;
		}
	}

	fill(now, n);

	for(int i = 1;i<=n;i++)
	{
		printf("%lld\n", result[i]);
	}
}

int main()
{
	int n;

	scanf("%d", &n);
	solve(n);

	return 0;
}